Memory control apparatus and method for storing data in a selected cache memory

ABSTRACT

A memory control apparatus is interposed between a central processing unit and a memory device to store data includes a plurality of cache memories to temporarily store data which is transferred between the central processing unit and the memory device and a cache memory control unit having a selector for selecting a cache memory to store data which is transferred from the memory device. The memory control apparatus assigns cache memories to store clean data and dirty data, which is updated data corresponding to the clean data, in accordance with a data identifier, whether a slot number is odd or even, or a usable amount of memory in the cache memories. The memory control apparatus selects a cache memory to store the data so as to almost equalized usage in the plurality of cache memories, thereby controlling the allocation of the cache memories.

The present application is a continuation of application Ser. No.09/370,998, filed Aug. 10, 1999, now U.S. Pat. No. 6,434,666; which is acontinuation of application Ser. No. 08/601,358 filed Feb. 16, 1996, nowU.S. Pat. No. 5,987,569, the contents of which are incorporated hereinby reference.

BACKGROUND OF THE INVENTION

The invention relates to an information processing system including amemory device and a memory control apparatus having a plurality of cachememories and, more particularly, to a memory control apparatus of aninformation processing system in which a memory device uses a RedundantArray of Inexpensive Disks (RAID) technique.

In a conventional memory control apparatus having a cache memory, inresponse to a write instruction from a central processing unit,completion of a writing process is reported to the central processingunit when write data has been stored into the cache memory in the memorycontrol apparatus. The storage of the write data into a disk device isexecuted by the memory control apparatus asynchronously with the writeinstruction from the central processing unit. Such a control is called awrite-after control. In the write-after control, when the end of writingprocess is reported to the central processing unit, since data is nottransferred to the disk device, a high-speed response to the centralprocessing unit can be performed.

In the data stored in the cache memory, the data before it istransferred to the disk device is called dirty data, and the data whichcoincides with the data in the disk device is called clean data. In aninformation processing apparatus for performing the write-after control,dirty data is data which exists only on the cache memory in the memorycontrol apparatus. Therefore, the dirty data cannot be deleted until thetransfer to the disk device is finished.

Data transfer speed between the cache memory and the disk device isslower than data transfer speed between the central processing unit andthe cache memory. There is consequently, a case where the cache memoryis filled with the dirty data at the time of the write-after control.Therefore, a memory control apparatus disclosed in JP-A-4-264940monitors an amount of dirty data in the cache, an inflow amount of writedata to the cache memory of each memory device, and an outflow amount ofdirty data due to the write-after process. When the dirty data amount inthe cache reaches a certain threshold value (permission amount), alimitation of the allocation of the cache memory to the write data and adata writing preferential execution to the memory device are executedfor the memory device in which (the inflow amount)>(the outflow amount).Due to the above control, a deterioration in performance of the wholesystem caused by the cache memory entering a full state is avoided andthe distribution of the allocation of the cache memory for every memorydevice can be properly performed.

In the write-after process, since the cache memory is volatile, there isa possibility that the dirty data is deleted due to a fault of a powersource of a control apparatus or the like, a fault of a hardware of thecache memory, or the like. Therefore, in “Evolution of the DASD storagecontrol” disclosed in IBM SYSTEMS JOURNAL, Vol. 28, No. 2, 1989, amemory control apparatus has therein a cache memory and a non-volatilestorage (NVS) of a small capacity for backup of dirty data, and thedirty data is duplexed and held in the cache memory and non-volatilestorage (NVS), thereby preventing deletion of the dirty data.

Further, a memory control apparatus having a plurality of cache memorieswhich is backed up by a battery is disclosed in JP-A-5-189314. Thememory control apparatus has a cache memory whose power source isdepleted by a battery backup. The cache memory is divided into Nportions and data read out from a memory device by a command from anupper apparatus is stored into an arbitrary one of the N dividedportions of the cache memory. Data which is written into the cachememory by an instruction from the upper apparatus is stored into twoarbitrary ones of the N divided portions of the cache memory. Thus,performance of the data at the time of a fault is improved and adeterioration of the performance can be prevented.

When using the RAID technique for the disk device as a memory device,the memory control apparatus needs to form parity data to guarantee dataat the time of the write-after process. Therefore, both the dirty data(write data) and the clean data (data which is updated by the writedata) need to be held on the cache memory.

In the memory control apparatus disclosed in JP-A-5-189314 in which datais duplexed and stored into a plurality of cache memories, the amount ofdata which cannot be deleted until the data transfer to the disk deviceis completed is largely divided between the depleted cache memoriesdepending on an allocating method of the cache memory for the cleandata. When an amount of dirty data (including the clean data to formparity data) in one cache memory reaches a cache memory capacity or apreset dirty data threshold value (permission amount), even in the casewhere there is a usable area in the other cache memory, the dirty datacannot be duplexed Thus, a response by the write-after process cannot beperformed and the performance deteriorates.

FIGS. 8(a) and 8(b) show a case where a cache surface (cache for storingclean data and dirty data as updated data of the clean data) and an NVSsurface (cache to store the dirty data) of each of a cache A 80 and acache B 81 of a memory control apparatus are fixedly used.

When using one of the two cache memories as a cache surface and theother as an NVS surface, as shown in FIG. 8(a), an amount of dirty datain the cache A 80 that is used as a cache surface is larger than anamount of dirty data in the cache B 81 that is used as an NVS surface.Thus, as shown in FIG. 8(b), when the cache A 80 which is used as acache surface is filled with the dirty data, in spite of the fact that anew usable area c still remains in the cache B 81, the dirty data cannotbe duplexed. Therefore, the write-after process cannot be performed.

SUMMARY OF THE INVENTION

An object of the invention relates to an allocation of cache memoriesand intends to improve the efficiency using or allocating of cachememory space by controlling a balance of using states of a plurality ofcache memories.

A To accomplish the above object, a memory control apparatus accordingto the invention comprises: a channel control unit, interposed between acentral processing unit and a memory device for storing data, forcontrolling a data transfer to/from the central processing unit; a drivecontrol unit for controlling data transfer to/from the memory device; aplurality of cache memories for temporarily storing data that istransferred between the central processing unit and the memory device;and a cache memory control unit having selecting means for selecting thecache memory to store data which is transferred from the memory device.The selecting device arbitrarily selects a first cache memory which isused as a cache surface and a second cache memory which is used as anNVS surface from among a plurality of cache memories. There is a casewhere the cache memory control unit of the memory control apparatus hasa memory device for storing control information of the memory controlapparatus.

When the data is read out from the memory device, the memory controlapparatus transfers the read data to the central processing unit andstores the data in the cache memory. In this instance, a memory controlapparatus arbitrarily selects the cache memory, which is used as a cachesurface (a cache for storing clean data and dirty data which is updateddata of the clean data) from a plurality of cache memories, and storesthe data in the selected cache memory.

When the data is written into the memory device, on the other hand, thememory control apparatus stores the write data transferred from thecentral processing unit into the cache memory. In this instance, whenthe data which is updated by the write data has been stored as cleandata in the cache memory, the cache memory is used as a cache surface,and clean data and dirty data which is updated data of the clean dataare stored in the cache surface. The memory control apparatusarbitrarily selects the cache memory which is used as a non-volatilestorage (NVS) surface from a plurality of cache memories and stores thedirty data into the cache memory.

As a specific method for when the memory control apparatus selects thecache memory, there is a method of selecting a cache memory on the basisof a virtual or physical address or an identifier of data such as asequence number or the like when dividing into management units.

There is another method including the steps of: storing usable/unusablestate information of each of the unit memories included in the cachememory into the control memory of the memory control apparatus; andcalculating the number of usable unit memories of each of the cachememories with reference to the usable/unusable state information of eachof the unit memories, and wherein the cache memory is selected by theusable unit memory.

There is yet another method including the steps of: storing memory usageamount information for each of the cache memories into the controlmemory of the memory control apparatus; arbitrarily selecting the firstcache memory and the second cache memory from a plurality of cachememories on the basis of the memory usage amount information of each ofthe cache memories; and storing dirty data amount information for eachof the cache memories or clean data amount information to form paritydata in the control memory, and wherein the cache memory is selected onthe basis of the dirty data amount information of each of the cachememories or the clean data amount information to form the parity data.

According to the invention, when data is read out from the memorydevice, the memory control apparatus selects the cache memory which isused as a cache surface from a plurality of cache memories and storesthe read data as clean data into the selected cache memory. Whenupdating the clean data, the memory control apparatus selects the cachememory which is used as an NVS surface from the plurality of cachememories and stores the write data into each of the cache memories whichare used as a cache surface and an NVS surface. In this instance theclean data stored in the cache memory that is used as a cache surface isalso held in the cache memory.

As mentioned above, the memory control apparatus according to theinvention arbitrarily selects the cache memories to be used as a cachesurface and an NVS surface from the plurality of cache memories.Therefore, a deviation of the using states among the plurality of cachememories can be reduced.

When the memory control apparatus selects the cache memory on the basisof an address of the data or a sequence number of the data, the data ofa certain group unit having certain characteristics is divided andallocated into the plurality of cache memories by the address orsequence number of the data. Therefore, expected values of probabilitiesat which the data in the cache memory is updated are averaged among theplurality of cache memories and a cache memory space can be effectivelyused. That is, the probability of the data to be updated differsdepending on the characteristics of the data. Therefore, by allocating agroup of data to the same cache memory, the occurrence of a deviation ofthe dirty data amounts among the plurality of cache memories inaccordance with the data characteristics is prevented, so that whichcache memory is allocated to the divided data is decided by anidentifier of the data.

When the memory control apparatus selects the cache memory on the basisof the number of requests for the allocation of the cache memory, thememory control apparatus has means for storing the number of processesby the cache memory selecting process or the number of blocks allocatedto the control memory. The memory control apparatus selects the cachememory on the basis of the number of processing times or the number ofblocks. Therefore, since the probability values at which the data in thecache memory is updated are averaged among the plurality of cachememories, the cache memory space can be effectively used.

Further, when the memory control apparatus selects the cache memory onthe basis of the cache memory using state, the memory control apparatushas means for storing the using state information of each of theplurality of cache memories in the control memory. The memory controlapparatus selects which cache memory is allocated in accordance with theusing state of the cache memory. According to the above control method,by averaging the present using states of the cache memories, the cachememory space is effectively used.

On the other hand, the cache memory in the memory control apparatus ofthe invention includes a plurality of unit memories and can close everyunit memory. When a certain unit memory is closed, the cache memoryincluding the closed unit memory is called a degenerate state. Whenthere is a cache memory in the degenerate state, a balance of thecapacities among the plurality of cache memories is divided. Therefore,it is necessary to control the memory allocation in consideration of acapacity ratio of the cache memory. For this purpose, the memory controlapparatus has means for storing the closed state information of eachunit memory as a component element of the plurality of cache memories,calculating the capacity of each cache memory by the closed stateinformation, and selecting the cache memory to be allocated inaccordance with a capacity ratio. In this instance, the above method canbe also commonly used.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows an information processing system according to an embodimentof the invention;

FIG. 2 shows detailed contents of a cache using state information;

FIG. 3 shows detailed contents of cache construction state information;

FIG. 4 shows an example of a selecting process of a cache memory of acache surface;

FIG. 5 shows an example of the selecting process of the cache memory ofthe cache surface;

FIG. 6 shows an example of the selecting process of the cache surface;

FIG. 7 shows an example of the selecting process of the cache surface;and

FIGS. 8(a) and 8(b) illustrate an explanatory diagram of a prior artconstruction of the subject matter of the invention.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

An embodiment of the invention will now be described hereinbelow withreference to the drawings.

FIG. 1 shows an information processing system according to an embodimentof the invention. The information processing system has a centralprocessing unit (CPU 1), a memory device 2, and a memory controlapparatus 3 connected to the processing unit 1 and memory device 2.

The memory control apparatus 3 is connected to the processing unit 1through a channel control 31 and is connected to the memory device 2through a drive control 32. Further, the memory control apparatus 3includes therein: non-volatile cache memories A 33 and B 34 which aremade non-volatile by a battery power source; a space allocation unit 35;a drive control unit 36; a cache control unit 37; a construction controlunit 38; and a control memory 39.

A construction of the memory device 2 and an outline of a flow of datawill now be described. The memory device 2 includes a disk array havinga plurality of disk devices 21. In the disk array, data 22 is dividedand divided data 221 is stored into the other different disk devices 21,respectively. Data (parity data) 222 to guarantee the data is formed bythe divided data 221 and is stored into the disk device 21 differentfrom the disk device in which the data 221 was stored.

In the embodiment, the divided data 221 is managed on a slot unit basis.The “slot” includes a plurality of records and is a unit which ismanaged by a unique number called a slot number. A state in which thedata corresponding to a read request and a write request issued from theprocessing unit 1 already exist in the cache memory A 33 or B 34 isreferred to as a read hit and a write hit, respectively. On thecontrary, a state in which the requested data does not exist in thecache memory is referred to as a read miss and a write miss,respectively. In the cache memory, data which coincides with the data inthe memory device 2 is called clean data. In the cache memory, updatedor modified data which is not stored in the memory device 2 but has beenstored in only the cache memory is called dirty data.

When the read request for the data 22 in the memory device 2 is issuedfrom the processing unit 1, the data is read out by each disk controlunit and, after that, the data 22 is stored in the cache memory A 33 orB 34.

When the write request for the memory device 2 is issued from theprocessing unit 1 the data to be updated is read out from the memorydevice 2 into the cache memory at the time of the write miss. When theupdated data is written into the cache memory, the memory controlapparatus 3 returns a response indicative of the end of the writingprocess to the processing unit (write-after control). In the writingprocess, the data written in the cache memory becomes dirty data. Thedirty data is duplexed and stored in the cache memories A 33 and B 34.In this instance, the clean data before updating which was read out fromthe memory device 2 is held as it is in the cache memory.

The process of writing the dirty data into the memory device 2 isexecuted asynchronously with the write request from the processing unit1. New parity data is formed by the dirty data and clean data in thecache memory. The dirty data and the new parity data are written intothe memory device 2. When the writing process is finished, the targetdata of the writing process does not need to be duplexed and held asdirty data in the cache memories. This data, accordingly, is held asclean data in either one of the two cache memories. The data can be alsodeleted from the chosen cache memory.

As mentioned above, the cache memory which stores the clean data and thedirty data, in which the clean data was updated, is called a cachesurface and the cache memory which stores the other one of the duplexeddirty data is called an NVS surface.

Control of the memory control apparatus which is used in the inventionwill now be described. The cache memory A 33 is constructed by n unitcache memories (A-1, A-2, . . ., A-n) 331 which can be individuallyclosed. A state of the cache memory including the closed cache memoryunit is referred to as a degenerate state. A state of the cache memorywherein all of the unit cache memory units 331 included in the cachememory are closed is referred to as a closed state. The same shall alsobe similarly applied to the cache memory B 34 and unit cache memories341.

The cache control unit 37 has space allocation means 371 for allocatingthe cache memory to store data when the data is stored into the cachememory in association with the reading/writing process from theprocessing unit 1.

A construction control unit 38 manages a normal/closed state of each ofthe cache memory units 331 and 341 and a normal/degenerate/closed stateof each of the cache memories 33 and 34, and holds cache constructionstate information 392 in control memory 39. The cache control unit 37manages using states of the cache memories 33 and 34 and holds cacheusing state information 391 in the control memory 39.

FIGS. 2 and 3 show the details of the cache using state information 391and cache construction state information 392. Usage state information3911 of the cache memory A and usage state information 3912 of the cachememory B are included in the cache using state information 391. Totalcapacities 39111 and 39121, total use amounts 39112 and 39122, dirtydata amounts 39113 and 39123, and usable memory capacities 39114 and39124 are recorded in the using state information 3911 and 3912,respectively. The total capacity is a capacity of the installed cachememory. The usable memory capacity is a normal total capacity of theunit cache memory. Cache memory A construction state information 3921and cache memory B construction state information 3922 are included inthe cache construction state information 392. Cache memoryusable/unusable information 39211 and 39221 and unit cache memoryusable/unusable information 39212 and 39222 are held in the constructionstate information 3921 and 3922, respectively. Further, the number ofexecutions of the selecting process of the cache memory of the cachesurface, namely, the number of executions of the allocation of thememory for the clean data is stored into the cache memory of the cachesurface by the cache control unit 37. The cache control unit 37 usesthat information when the cache memories are allocated.

An example of a process for selecting the cache memory which is used asa cache surface from the cache memory A 33 or B 34 when allocating thecache memories will now be described. In the embodiment, since only twocache memories are provided, the selecting process of the NVS surface isunnecessary. When the read request is issued from the processing unit 1to the memory device 2, the read data is read out from the disk deviceand then the data 22 is stored in the cache memory selected as a cachesurface by the cache control unit 37.

When the write request is issued from the processing unit 1 to thememory device 2, in case of the write miss, the cache memory which isused as a cache surface is selected by the cache control unit 37. Thememory control apparatus 3 stores the updating target data which wasread out from the memory device 2 into the cache memory of the cachesurface, and writes the updated data into the cache memory serving as acache surface and the other cache memory serving as an NVS surface. Incase of the write hit, the dirty data, which is updated data for theclean data is stored in the cache memory of the cache surface in whichthe clean data has been stored with the other cache memory, saved as anNVS surface. In this instance, the clean data is held as it is in thecache memory of the cache surface.

An example of the process for selecting the cache memory that is used asa cache surface will now be described with reference to a flowchart.

FIG. 4 shows an example of the process of selecting the cache memorywhich is used as a cache surface. The cache control unit 37 refers tothe slot number of the data which is stored in the cache memory (step400). A check is made to see if the slot number is an even number or anodd number (step 410). When the slot number is an even number, the cachememory A 33 is selected as a cache memory which is used as a cachesurface (step 420). When the slot number is an odd number, the cachememory B is selected as a cache memory which is used as a cache surface(step 430). The allocating process of the cache memories then isexecuted (step 440). In the example, although the above selectiondetermination has been made on the basis of whether the slot number isan even number or an odd number, so long as any deviation of datacharacteristics is small, it is also possible to distribute the cachesurfaces to every slot number and to select therefrom.

FIG. 5 shows another example of the process of cache memory selectingprocess of the cache memory which is used as a cache surface. The cachecontrol unit 37 refers to the cache memory A dirty data amount 39113 inthe control memory 39 and the cache memory B dirty data amount 39123.The dirty data amounts 39113 and 39123 are compared (step 510). Thecache memory of a smaller dirty data amount is selected as a cachememory which is used as a cache surface (steps 520, 530). The allocationof the cache memories is performed (step 540).

FIG. 6 shows still another example of the cache memory selecting processof the cache surface. In step 600, the cache control unit 37 refers to acounter 393. In step 610, a determination is made to see if a countervalue of the counter 393 is all even number or an odd number, and on thebasis of the determination result, the cache surface cache memory A or Bis selected (steps 620, 630). The cache memories arc allocated in step640.

FIG. 7 shows another example of the cache memory selecting process ofthe cache surface. The cache control unit 37 refers to the cacheconstruction state information 392 (step 700). The usable memorycapacities 39114 and 39124 of the cache memories are calculated,respectively (step 710) and are recorded in the cache using stateinformation 391. Subsequently, a usable memory capacity ratio of everycache memory surface is calculated (step 720). It is now assumed thatthe capacity ratio (cache memory A:cache memory B) is equal to N:M. Instep 730, the slot number is referred to in a manner similar to theselecting process shown in FIG. 4. A remainder when the slot number isdivided by (N+M) is obtained (step 740). When the remainder is equal toor less than N, the cache memory A is selected as a cache surface (step750). In the other cases, the cache memory B is selected as a cachesurface (step 760). In step 770, the cache memories are allocated. Inthe example, although the selection of the cache surface by the slotnumber has been shown, the selecting process by the counter value shownin FIG. 6 can also be used in steps 730 to 750.

The example of the selecting process of the cache memory of the cachesurface has been shown above. In the embodiment, since only two cachememories are provided, the selecting process of the NVS surface isunnecessary. When providing N cache memories, however, the selectingprocess is also needed with respect to the selecting process of the NVSsurface. In such a case, it will be obviously understood that theselecting process of the cache memory as a cache surface can be applied.

The memory control apparatus according to the invention can arbitrarilyselect the cache memory which is used as a cache surface or an NVSsurface from among a plurality of cache memories. Therefore, the usingstates of the cache memories can be preferably balanced and there is aneffect such that the using efficiency of the space of the cache memoryis improved.

What is claimed is:
 1. A memory control apparatus, in a RAID structurewhich is interposed between a central processing unit and a memorydevice for storing data, having a plurality of cache memories fortemporarily storing data of said memory device, and for transferringdata between said central processing unit and said memory device, saidmemory control apparatus comprising: a control unit for controlling saidcache memories and for assigning a cache memory for storing clean data,and dirty data which is updated data corresponding to the clean data,and a cache memory for storing said dirty data, wherein said controlunit assigns the cache memory in accordance with at least one of dataidentifier, a data slot number, or a usable memory amount in a cachememory when said control unit stores data in one of said cache memories.2. A memory control apparatus, which is interposed between a centralprocessing unit and a memory device for storing data, having a pluralityof cache memories for temporarily storing data of said memory device,for transferring data between said central processing unit and saidmemory device, said memory control apparatus comprising: a control unitfor controlling said cache memories and for assigning a cache memory forstoring clean data and a cache memory for storing dirty data, which isupdated data corresponding to the clean data; means for storing cacheusing state information of each of said plurality of cache memories,wherein a cache memory for storing is assigned in accordance with acomparison between said cache using state information of each of saidplurality of cache memories, when said control unit assigns a cachememory for storing said clean data and dirty data which is updated dataconcerned with said clean data, and a cache memory for storing saiddirty data.
 3. A memory control apparatus, which is interposed between acentral processing unit and a memory device for storing data, having aplurality of cache memories for temporarily storing data of said memorydevice, and for transferring data between said central processing unitand said memory device, wherein each of said plurality of cache memoriesincludes at least one cache memory unit, said memory control apparatuscomprising: means for storing usable/unusable information for each cachememory unit; and a control unit for controlling said plurality of cachememories and for assigning a cache memory for storing clean data anddirty data, which is updated data concerned with said clean data, and acache memory for storing said dirty data in accordance with saidusable/unusable information, wherein said control unit assigns a cachememory to write-in, when write-in to the cache memory is to occur.
 4. Ina memory control apparatus, which is interposed between a centralprocessing unit and a memory device for storing data, having a pluralityof cache memories for temporarily storing data of said memory device,for transferring data between said central processing unit and saidmemory device, a cache control method, responsive to a data writerequest from said central processing unit, comprising the steps of:judging whether said write request is a write hit, and when said writerequest is a write hit, storing dirty data which is updated dataconcerned with clean data into a cache memory in which said clean datais stored and into a cache memory, other than the cache memory in whichsaid clean data is stored; when said write request is not a write hit,reading cache using state information from means for storing cache usingstate information indicating using state for each of said plurality ofcache memories, and comparing said cache using state information of eachof said plurality of cache memories; and in response to said reading andcomparing step, assigning a cache memory for writing said clean data andsaid dirty data and a cache memory for writing said dirty data.
 5. In amemory control apparatus, which is interposed between a centralprocessing unit and a memory device for storing data, having a pluralityof cache memories for temporarily storing data of said memory device,for transferring data between said central processing unit and saidmemory device, a cache control method, responsive to a data writerequest from said central processing unit, comprising the steps of:determining whether said write request is a write hit, and when saidwrite request is a write hit, storing dirty data which is updated dataconcerned with clean data into a cache memory in which said clean datais stored and into a cache memory, other than the cache memory in whichsaid clean data is stored; and when said write request is not a writehit, assigning a cache memory for writing said clean data and said dirtydata and a cache memory for writing said dirty data in accordance witheither one of a slot number to which an updating object number is storedor an identifier of data, wherein said control unit assigns a cachememory to write-in, when write-in to the cache memory is to occur.